package acwing._2LanQiao._9DP;
/**
 * @Project : AlgorithmLearning
 * @Package : ACWing._2LanQiao._9DP
 * @File : Q1050.java
 * @Author : WangRuoyu
 * @Date : 2023/3/23 14:56
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Q1050 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] words = br.readLine().split(" ");

        int t = Integer.parseInt(words[0]);
        for (int i = 0; i < t; ++i) {
            words = br.readLine().split(" ");
            int m = Integer.parseInt(words[0]);
            int n = Integer.parseInt(words[1]);
            int[][] f = new int[m + 1][n + 1];
            for (int j = 1; j <= n; ++j) {
                f[0][j] = 1;
            }
            for (int j = 1; j <= m; ++j) {
                for (int k = 1; k <= n; ++k) {
                    f[j][k] = f[j][k - 1];
                    if (j >= k) {
                        f[j][k] += f[j - k][k];
                    }
                }
            }
            System.out.println(f[m][n]);
        }
    }
}
